package java_06_stream;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class java_06 {
	public static void main(String[] args) {
		int[] arr1={1,2,3,3,5};
		int[] arr2={1,2,3,4};
		removeint(arr1, arr2);
	}
	private static void removeint(int[] arr1, int[] arr2) {
		HashSet<Integer> set1 = new HashSet<>();
		for(int i:arr1){
			set1.add(i);
		}
		Set<Integer> set2 = new HashSet<>();
		for (int num : arr2) {
			set2.add(num);
		}
		List<Integer> onlyarr1=new ArrayList(set1);
		List<Integer> onlyarr2=new ArrayList(set2);
		onlyarr1.removeAll(set2);
		onlyarr2.removeAll(set1);
		Set<Integer> resultSet = new HashSet<>();
		resultSet.addAll(onlyarr1);
		resultSet.addAll(onlyarr2);
		resultSet.stream()
		.forEach(s->System.out.print(s+" "));
	}
}
